# @Time : 2023/1/4
# @Author : SDAJAVA

fp = open('test.txt', 'w')

fp.write('hello world')

fp.close()
# 读取出内容
# fp1 = open('test.txt', 'r')
# content = fp1.readline()
# print(content)

fp1 = open('test.txt', 'w')
nameList = ['zhangsan', 'lisi']
# 序列化的两种方式
# 导入JSON模块
import json

names = json.dumps(nameList)
print(names)
fp1.write(names)
fp1.close()
